<?php namespace Summer\Shop\Updates;

use Schema;
use Winter\Storm\Database\Updates\Migration;

class BuilderTableCreateSummerShopProducts extends Migration
{
    public function up()
    {
        Schema::create('summer_shop_products', function($table)
        {
            $table->engine = 'InnoDB';
            $table->increments('id')->unsigned();
            $table->timestamp('created_at')->nullable();
            $table->timestamp('updated_at')->nullable();
            $table->timestamp('deleted_at')->nullable();
            $table->string('name');
            $table->string('slug')->nullable();
            $table->integer('brand_id')->nullable();
            $table->integer('category_id')->nullable();
            $table->string('code')->nullable();
            $table->integer('stock')->nullable();
            $table->smallInteger('is_with_variants')->nullable()->default(0);
            $table->text('variants')->nullable();
            $table->decimal('price', 14, 2)->nullable()->default(0.00);
            $table->decimal('price_old', 14, 2)->nullable()->default(0.00);
            $table->integer('sales_count')->nullable()->default(0);
            $table->smallInteger('status')->nullable()->default(1);
            $table->smallInteger('is_new')->nullable()->default(0);
            $table->smallInteger('is_hot')->nullable()->default(0);
            $table->smallInteger('is_recommend')->nullable()->default(0);
            $table->smallInteger('is_home_show')->nullable()->default(0);
            $table->text('description_short')->nullable();
            $table->text('description')->nullable();
            $table->string('meta_title')->nullable();
            $table->text('meta_keywords')->nullable();
            $table->text('meta_description')->nullable();
            $table->integer('weight')->nullable()->default(0);
            $table->integer('length')->nullable()->default(0);
            $table->integer('width')->nullable()->default(0);
            $table->integer('height')->nullable()->default(0);
            $table->decimal('shipping_fee', 14, 2)->nullable()->default(0.00);
        });
    }
    
    public function down()
    {
        Schema::dropIfExists('summer_shop_products');
    }
}
